{include file='public/head'}
<style>
    .layui-form-checkbox{
        padding-left: 0px !important;
    }
</style>
<body>
<div class="x-body">
    <form class="layui-form" id='mainForm' method="post" action="synchPrice">
        <table class="layui-table">
            <colgroup>
                <col style="width: 20px">
                <col>
            </colgroup>
            <thead>
            <tr>
                <th>
                    <div class="header layui-form-checkbox" lay-skin="primary"><i class="layui-icon">&#xe605;</i></div>
                </th>
                <th>变体同步数据参数</th>
            </tr>
            </thead>
            <tbody>
            <tr>
                <td>
                    <div class="layui-form-checkbox" lay-skin="primary" data-id='price'>
                        <i class="layui-icon">&#xe605;</i>
                    </div>
                </td>

                <td>变体默认价格同步为产品基本信息默认价格</td>
            </tr>
            <tr>
                <td>
                    <div class="layui-form-checkbox" lay-skin="primary" data-id='saleprice'>
                        <i class="layui-icon">&#xe605;</i>
                    </div>
                </td>

                <td>变体销售价格同步为产品基本信息销售价格</td>
            </tr>
            <tr>
                <td>
                    <div class="layui-form-checkbox" lay-skin="primary" data-id='cost'>
                        <i class="layui-icon">&#xe605;</i>
                    </div>
                </td>

                <td>变体成本价同步为产品基本信息成本价</td>
            </tr>
            <tr>
                <td>
                    <div class="layui-form-checkbox" lay-skin="primary" data-id='kucun'>
                        <i class="layui-icon">&#xe605;</i>
                    </div>
                </td>
                <td>变体库存同步为产品基本信息库存</td>
            </tr>
            </tbody>
        </table>



        <input type="hidden" id="proname" name="proname" value="{$Think.get.proname}">
        <input type="hidden" id="code" name="code" value="{$Think.get.code}">
        <input type="hidden" id="platform" name="platform" value="{$Think.get.platform}">
        <input type="hidden" id="lang" name="lang" value="{$Think.get.lanid}">
        <input type="hidden" id="audit" name="audit" value="{$Think.get.audit}">
        <input type="hidden" id="bname" name="bname" value="{$Think.get.bname}">
        <input type="hidden" id="guids" name="guids" value="">
        <input type="hidden" id="source" name="source" value="{$Think.get.source}">
        <input type="hidden" id="start" name="start" value="{$Think.get.start}">
        <input type="hidden" id="end" name="end" value="{$Think.get.end}">

        <button class="layui-btn" id="btn_save" type="button" style="display: none">提交</button>
    </form>
</div>
</body>
{include file='public/foot'}
<script>
    var layer = layui.layer;
    var form = layui.form;
    $("#guids").val(parent.$('#guid').val());

    $('#btn_save').click(function () {
        var data = tableCheck.getData();
        if (data.length == 0) {
            layer.msg("请选择需要同步的选项");
            return false;
        }

        var formData = new FormData(document.getElementById("mainForm"));//表单id
        formData.append("choose",data);
        // 提交成功后样式修改
        layer.load(1);
        $.ajax({
            url: '',
            type: 'POST',
            data: formData,
            async: false,
            cache: false,
            contentType: false,
            processData: false,
            success: function (data) {
                layer.closeAll('loading');
                if (data.code == 0) {
                    layer.msg(data.msg);
                } else {
                    layer.msg(data.msg, {icon: 1, time: 500}, function () {
                        $("#reset").click();
                        x_admin_close();
                        parent.location.reload();
                    });
                }
            }
        });
    });
</script>